GBML manual / Backgrounds

perspective_floor_camera

Puts the perspective floor’s camera over the picture at (x, y) and turns it to face heading degrees.

Game Boy: not available

Game Boy Color: not available

Sega Genesis: not built yet - The Sega Genesis will draw the road its own way.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

perspective_floor_camera(x, y, heading)

Arguments

NameType
xreal
yreal
headingreal

Returns

Nothing.

Description

Puts the perspective floor's camera over the picture at (x, y) and turns it to face heading degrees. It does nothing in a room that has no zoomable background.

x and y are a place on the picture, counted from the picture's top-left corner in the picture's own pixels (a 1024 by 1024 picture runs 0 to 1024 both ways) - not a place on the screen, and not a place in the room.

heading is in degrees, counter-clockwise like every angle in this manual: 0 looks up the picture (toward y = 0), 90 looks left, 180 looks down, 270 looks right. Any number works.

Call it every frame the camera moves. A frame in which nothing changed costs nothing extra.

Example

// Step event of the car: the camera rides 44 pixels behind it, looking where the car looks.
perspective_floor_camera(x + angle_sin(angle) * 44, y + angle_cos(angle) * 44, angle);

The car's own place and angle are on the picture; the camera stands behind the car along the line it is facing, so the car is always just ahead of it.

On the GBA

A no-op in a room that has no zoomable background. x and y are places on the picture, counted from its top-left corner in the picture’s own pixels (a 1024 by 1024 picture runs 0 to 1024 both ways). Heading is in degrees, counter-clockwise like every angle in this manual: 0 looks up the picture (toward y = 0), 90 looks left, 180 looks down, 270 looks right. Call it every frame the camera moves; a frame in which nothing changed costs nothing extra.

See also: Perspective floorperspective_floorperspective_floor_heightperspective_floor_project